{include file="public/header" /}
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>供应商入驻发票管理</h3>
                <h5></h5>
            </div>
        </div>
    </div>

    <table class="ds-default-table">
        <thead>
        <tr class="thead">
            <th>供应商名称</th>
            <th>公司名称</th>
            <th>公司税号</th>
            <th>注册地址</th>
            <th>开户行</th>
            <th>开户银行账号</th>
            <th class="align-center">注册电话</th>
            <th class="align-center">审核状态</th>
        </tr>
        </thead>

        <tbody>
            <?php if(!empty($invoiceLists)):?>
            <?php foreach($invoiceLists as $itemObj):?>
            <tr class="hover" id="">
                <td><?php echo $itemObj->store_id;?></td>
                <td><?php echo $itemObj->company_name;?></td>
                <td><?php echo $itemObj->company_tax;?></td>
                <td><?php echo $itemObj->company_addr;?></td>
                <td><?php echo $itemObj->bank_type;?></td>
                <td><?php echo $itemObj->bank_account;?></td>
                <td><?php echo $itemObj->company_phone;?></td>
                <!--  已通过发票审核的,显示灰色按钮  -->
                <td>
                    <?php if($itemObj->check_state == 1):?>
                        <button class="btn" style="background-color: #94b13b;" flag="<?php echo $itemObj->store_id;?>">已核实无误</button>
                    <?php elseif($itemObj->check_state == 0):?>
                        <button class="btn wait_pass" onclick='dealInvoiceCheck("<?php echo $itemObj->store_id;?>",1)'>核实通过</button>
                        <button class="btn repass" onclick='dealInvoiceCheck("<?php echo $itemObj->store_id;?>",0)'>重新提交</button>
                    <?php else:?>
                        <button class="btn not_pass" flag="<?php echo $itemObj->store_id;?>" style="background-color:#6a6b68;">审核未通过</button>
                    <?php endif;?>
                </td>
            </tr>
            <?php endforeach;?>
            <?php endif;?>
        </tbody>
</div>
<!--  处理发票审核  -->
<script type="text/javascript">
    // <!--  处理供应商发票审核  -->
    function dealInvoiceCheck(store_id = 0,check_state = 0){
        var postData = {
            "store_id":store_id,
            "check_state" : check_state
        };
        //发送处理请求
        $.post(
            "{:url('invoice/storeInvoiceCheck')}",
            postData,
            function (res) {
                console.log(res);
            }
        );
    }
</script>